<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <link href="/Public/admin/css/style.css" rel="stylesheet">
    <link href="/Public/admin/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/Public/plugin/editor/themes/default/default.css" />
    <link href="/Public/plugin/select2/select2.css" rel="stylesheet">
    <script charset="utf-8" src="/Public/plugin/editor/kindeditor.js"></script>
    <script charset="utf-8" src="/Public/plugin/editor/lang/zh_CN.js"></script>
    <style>
        #imgList{
            max-width:510px;
        }
        #imgList .imgBox{
            width:160px;
            height:100px;
            position:relative;
            float:left;
            overflow:hidden;
            border:1px solid #ccc;
            margin-right:5px;

        }
        .imgBox img{
            width:156px;
            height:96px;
            margin:2px 2px;
        }
        .close_icon{
            position:absolute;
            cursor:pointer;
            right:0px;
            top:-5px;
            color:#666;
            display:none;
            font-size:14px;
        }
        .borders{
            position:relative;
            width:400px;
            height:20px;
        }
        .borders div,.borders span{
            display:inline-block;
        }
    </style>
    <title>{$title}</title>
</head>
<body>
<div class="breadNav">
    <ul class="breadNavBar">
        <li><i class="icon-home" style="font-size:16px"></i></li>
        <li><a href="javascript:;" onClick="parent.location.reload('/Admin/Index/index');">首页</a></li>
        <li>&gt;</li>
        <li><a href="__ROOT__/Admin/Books/Book_list/cat_two/{$bookli.cata_id}">书籍管理</a></li>
        <li>&gt;</li>
        <li>添加书籍</li>
    </ul>
</div>
<div style="clear:both;"></div>
<div class="filter">
    <a href="__ROOT__/Admin/Books/Book_list/cat_two/{$cata_id}" class="btn btn-primary btn-lg" id="backBtn"><i class="icon-reply"></i>&nbsp;返回</a>
</div>
<form id="form" class="from" method="post" action="">
    <div class="form-group">
        <label class="control-label">书籍名称:</label>
        <input type="text" name="name" class="form-control" value="{$goodsInfo.goodsName}" style=" width:500px;">
        <span class="helpBlock"></span>
    </div>

    <!--<div class="form-group">-->
        <!--<label class="control-label">书籍分类:</label>-->
        <!--<select id="catID" name="catID" style="width: 140px;">-->
            <!--<option value="0">请选择商品分类</option>-->
            <!--<volist name="categoryList" id="categoryList">-->
                <!--<option  style="color: #999;" disabled="disabled">┃ {$categoryList.catName}</option>-->
                <!--<volist name="categoryList['parent']" id="parent">-->
                    <!--<option value="{$parent.id}">┣━ {$parent.catName}</option>-->
                    <!--<volist name="parent['child']" id="child">-->
                        <!--<option value="{$child.id}">{$child.catName}</option>-->
                    <!--</volist>-->
                <!--</volist>-->

            <!--</volist>-->
        <!--</select>-->
        <!--<span class="helpBlock"></span>-->
    <!--</div>-->

    <div class="form-group">
        <label class="control-label">封面图片:</label>
        <img id="coversrc" width="156" height="96" style="margin:2px;" src=''>
        <input type="hidden" id="cover" name="cover" class="form-control disBlock" value="" style="width:300px;">
        <button type="button" id="cover_btn" class="btn btn-primary disBlock"><i class="icon-plus"></i>&nbsp;图片</button>
        <span class="helpBlock disBlock">图片建议尺寸：宽390像素、高480像素，图片最大不超过1M</span>
    </div>
    <div class="form-group">
        <label class="control-label">书籍原价:</label>
        <input type="text" name="price" class="form-control" value="" style=" width:200px;">
        <span class="helpBlock"></span>
    </div>

    <div class="form-group">
        <label class="control-label">分享减价:</label>
        <input type="text" name="minus" class="form-control" value="" style=" width:200px;">
        <span class="helpBlock"></span>
    </div>
    <div class="form-group">
        <label class="control-label">出售数量:</label>
        <input type="text" name="number" class="form-control" value="" style=" width:200px;">
        <span class="helpBlock"></span>
    </div>

    <div class="form-group">
        <label class="control-label">内容摘要:</label>
        <textarea id="about" name="about" class="form-control" style="width:400px; height:160px;"></textarea>
        <span class="helpBlock"></span>
    </div>


    <div class="form-group">
        <label class="control-label">&nbsp;</label>
        <input type="hidden" name="cata_id" value="{$cata_id}" />
        <button class="btn btn-primary"><i class='icon-check'></i>&nbsp;保存</button>
    </div>
</form>
</body>
<script src="/Public/js/jquery.min.js?ver=1.8.3"></script>
<script src="/Public/admin/js/main.js"></script>
<script src="/Public/js/vali.js"></script>
<script src="/Public/js/prompt.js"></script>
<script src="/Public/plugin/select2/select2.min.js"></script>
<script>

    KindEditor.ready(function(K) {
        var editorgoodsCover = K.editor({
            basePath: '/Public/plugin/editor/'
            ,uploadJson : '/Public/plugin/fileup/upload_json.php?type=image&m=books'
            ,fileManagerJson : '/Public/plugin/fileup/file_manager_json.php?type=image&m=books'
            ,allowFileManager:true
        });
        K('#cover_btn').click(function() {
            editorgoodsCover.loadPlugin('image', function() {
                editorgoodsCover.plugin.imageDialog({
                    imageUrl : K('#cover').val(),
                    clickFn : function(url, title, width, height, border, align) {
                        K('#cover').val(url);
                        $('#coversrc').attr('src',url);
                        editorgoodsCover.hideDialog();
                    }
                });
            });
        });

        var editor = K.create('#about',{
            width : '700px'
            ,height: '300px'
            ,basePath: '/Public/plugin/editor/'
            ,uploadJson : '/Public/plugin/fileup/upload_json.php?type=image&m=books'
            ,fileManagerJson : '/Public/plugin/fileup/file_manager_json.php?type=image&m=books'
            ,allowFileManager:true
            ,afterChange:function(){ //内容发生变化后
                this.sync();
            }
            ,afterFocus:function(){ //得到焦点时
                this.sync();
            }
            ,afterBlur: function(){ //失去焦点时
                this.sync();
            }
        });
    });
    $(document).ready(function() {
        $('#catID').select2();
        $("form").vali({
            "control": [
                {"id": "name", "rule": "notNull", "errorText": ""},
                {"id": "minus", "rule": "notNull", "errorText": ""},
                {"id": "number", "rule": "notNull", "errorText": ""},
                {"id": "cover", "rule": "notNull", "errorText": "请上传封面图片"},
                {"id": "price", "rule": "notNull", "errorText": ""},
                {"id": "about", "rule": "notNull", "errorText": ""},
            ]
        })
    })

</script>
</html>
